package com.cssw.fyzb.busi.api.live;

import com.cssw.fyzb.core.model.vo.live.LiveFriendVo;
import com.cssw.fyzb.busi.service.live.LiveService;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import com.ydn.dbframe.plugin.activerecord.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 查询直播好友列表
 * @author yangyiqun
 */
@Function(description = "查询直播好友列表", parameters = {
        @Parameter(name = "userId", type = Type.String, description = "用户标识", required = true),
        @Parameter(name = "pageNumber", type = Type.String, description = "页码", required = true),
        @Parameter(name = "pageSize", type = Type.String, description = "页面条数", required = true)
})
@Component
public class ListLiveFriend implements Action {

    @Autowired
    LiveService liveService;

    @Override
    public Response execute(Request request) throws Exception {
        Long userId = request.getLong("userId");
        Integer pageNumber = request.getInteger("pageNumber");
        Integer pageSize = request.getInteger("pageSize");

        Page<LiveFriendVo> page = liveService.listLiveFriend(userId, pageNumber, pageSize);
        return Response.success().put("list", page.getList()).put("total", page.getTotalPage()).put("count", page.getTotalRow());
    }
}





